<%@ page import="util.DBUtil" %>
<%@ page import="java.sql.ResultSet" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/10/26
  Time: 15:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品信息管理</title>
</head>
<body>
    <h2>商品信息录入</h2>
    <form action="product_add_do.jsp" method="post">
    <table>
        <tr><td>商品分类</td>
            <td>
                <select name="type_id">
                    <%//读取商品分类信息表的数据，加载到下拉框中
                        DBUtil dbUtil =new DBUtil();
                        String sql ="select * from tb_product_type";
                        ResultSet rs =dbUtil.query(sql);
                        while (rs.next()){
                            out.println("<option value="+rs.getInt("id")+">"
                                    +rs.getString("type_name")
                                    +"</option>");
                        }
                    %>
                </select>
            </td>
        </tr>
        <tr><td>商品名称</td>
            <td> <input type="text" name="product_name"></td>
        </tr>
        <tr>
            <td>商品图片</td>
            <td> <input type="file" name="logo"> </td>
        </tr>
        <tr>
            <td>商品简介</td>
            <td>
                <textarea cols="40" rows="5" name="intro"></textarea>
            </td>
        </tr>
        <tr>
            <td>是否置顶</td>
            <td>
                <input type="radio" name="is_top" value="1">  是
                <input type="radio" name="is_top" value="0" checked>  否
            </td>
        </tr>
        <tr>
            <td>排序序号</td>
            <td> <input type="text" name="idx" value="100"></td>
        </tr>
        <tr>
            <td>商品价格</td>
            <td> <input type="text" name="price"></td>
        </tr>
        <tr>
            <td>优惠价格</td>
            <td><input type="text" name="sale_price"></td>
        </tr>
        <tr>
            <td>状态</td>
            <td>
                <input type="radio" name="status" value="1" checked>  上架
                <input type="radio" name="status" value="0">  下架
            </td>
        </tr>
        <tr><td colspan="2">
            <input type="submit" value="提交"></td>
        </tr>
    </table>
   </form>
</body>
</html>
